home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Directorytools / DuM2 / DuMod2.doc < prev    next >
Text File  |  1996-09-26  |  18KB  |  344 lines

  1. TDI Modula-2 Directory Utility v1.5 - By Greg Browne
  2.  
  3. (reached through New Horizons BBS-PC at  505-437-9117 after 7:00 p.m. MST)
  4. ( or Las Cruces RCP/M at 505-524-8372 any time                           )
  5.  
  6. Why write another Directory Utility with all the available 'c' code versions?
  7.  
  8. Have you ever tried to read your M2: directory with them?  They only allow
  9. 100 files in a directory. I have over 230 in my M2: directory, and they just
  10. pretend the ones over 100 aren't there.  So...this allows 300 as written.
  11. It can be expanded or shrunk  easily by recompiling DuDir.def/.mod with a
  12. different MaxMax.
  13.  
  14. This is my first larger project in Modula-2. I am sure there are many things
  15. I could have done more sleekly and professionally.  If someone hacks this up
  16. and makes it better, all I ask is that they put their efforts up on some
  17. boards for others to study. THERE IS VERY LITTLE STUDY MATERIAL FOR MODULA-2
  18. ON THE AMIGA.  It could be remedied if everyone shared their discoveries.
  19.  
  20. ALL I ASK IS THAT YOU LEAVE THIS DOCUMENT (ALTERED THOUGH IT MAY BE) WITH
  21. THE PROGRAM, AND THAT YOU PUT ADEQUATE COMMENTS INTO THE SOURCE CODE SO
  22. SOMEONE CAN FIGURE OUT WHAT YOU DID. (EVEN IF I DIDN'T)
  23.  
  24. Thanks to Richie Bielack (who doesn't know me) for the gadget ideas and the
  25. WBStartup code example, and to all the zillions of 'c' programmers for the
  26. general DU structure ideas. Also to Les Caudle at TDI, who was very patient
  27. with me on the phone several times.
  28.  
  29. BUG:  I seem to have missed something, and I can't find ANYTHING to cause
  30.       it, but twice (out of hundreds of runs) it has just gone away.
  31.       NOT guru, just freeze in place. If you find it, tell me where. I know
  32.       it isn't stack problem, because mostly it runs great even with a
  33.       4000 stack. (The big array for filenames is AllocMem'ed).
  34.  
  35. DISCLAIMER:  I take no responsibility for damage or lost files if someone
  36.              is foolish enough to use this on valuable files untested.
  37.              I am NOT a professional programmer, and am prone to as many
  38.              mistakes as anyone else.
  39.  
  40. PERSONAL: This program is specifically placed in the public domain. Take
  41. FOIBLES   this code and use it, delete it, hack it, give it away, copy
  42.           it or whatever.  Just don't try to sell it.  (I doubt that it is
  43.           worth much anyway).  Please, please, don't have the gaul to take
  44.           p.d. software, alter it, and call it 'shareware' just because you
  45.           add a nice feature to it. (It will probably Guru on the user and
  46.           cause them to hate you). I dislike seeing 'shareware' on so many
  47.           programs "just in case" the program proves to be useful. Shareware
  48.           used to be reserved for significant 'programs' (not utilities), but
  49.           it is so misused lately that it is no wonder so many people don't
  50.           honor it. Don't get me wrong, some programs are worth paying for.
  51.           If someone needs 'incentive' to continue developing programs, then
  52.           they should go into it for a serious living.  Otherwise, do it for
  53.           the love of it or don't do it. (This will probably make me some
  54.           kind of villain to some of you, but I'll survive.)
  55.  
  56. (* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *)
  57.                            OPERATION NOTES
  58.  
  59. Please realize that everything in this program is "relative verify".  That
  60. means you have to press AND RELEASE the left mouse button over a gadget
  61. (or name) for it to register with the program.  You can sometimes save some
  62. grief by moving the pointer off a gadget without releasing the mouse button,
  63. and then releasing it in some blank area.
  64.  
  65. ALSO if you are doing some multiple-file item like COPYDEL or ZAPFILE, you
  66. may interrupt it by pressing the mouse button on something.  It will halt
  67. after the current operation is complete. (COPYDEL Includes deleting  the
  68. source file it is copying as part of the same operation - sorry!)
  69.  
  70. (*-----------------------------------------------------------------------*)
  71.  
  72. The screen has 5 major divisions.
  73.  1)  The large 'window' is the file display area. It is where files are
  74.      shown for selected directories. (It is a gadget, by the way)
  75.  2)  Immediately above this window is a series of device selection gadgets.
  76.      These are "one-click-direct-select" gadgets.
  77.  3)  To the right of the window is a slider.  This allows scrolling through
  78.      lists of filenames which are too long to show in a (15 name) window.
  79.  4)  To the right of the slider are the 'BUTTON GADGETS'.  They are the
  80.      click-select functions. Some are used alone, others in conjunction
  81.      with the other areas as will be described.
  82.  5)  Below the 'GADGETS' are the string display areas, marked R,S,D, and M.
  83.      These are for typed input and messages back to you.
  84.  
  85. DEVICE SELECTION GADGETS: -> df0: df1: df2: dh0: dh1: ram: vd0:
  86.  
  87.   Clicking the left mouse button on any of these will cause the selection
  88.   of this device. It will be read and the files displayed in the filewindow.
  89.  
  90. FILEWINDOW GADGET:
  91.  
  92.   Clicking on top of an 'unselected' filename (white on black) causes it to
  93.   be 'selected' and means it will be included in several multiple-file
  94.   operations which are described below.
  95.  
  96.   Clicking on a 'selected' filename (black on white) will 'unselect' it.
  97.  
  98.   Clicking on a directory name (orange on black) will cause it to be
  99.   'selected'.  A prompt will appear in the message field (M) and give you
  100.   the option of switching into that directory with a second click on top
  101.   of it.  (Clicking anywhere else will cancel this option).
  102.   Clicking on a selected (but entry cancelled) directory will 'unselect' it.
  103.   Note that a click to cancel is not acted on except as a cancel.
  104.  
  105.   NOTE That only one directory at a time may be 'selected'.
  106.        Any and/or all filenames may be 'selected'.
  107.  
  108. SLIDER GADGET:
  109.  
  110.   The slider is a convenient way of scrolling through a long list of
  111.   filenames for review.  (This Du handles 300 names as currently written).
  112.   Clicking below the white portion of the slider (in the background area)
  113.   will advance a 'page' of names. You can also click-hold on the slider and
  114.   move it wherever you wish.  If the slider is filled and will not move,
  115.   then all files/directories are displayed.
  116.  
  117. STRING INPUT/OUTPUT GADGETS: -> Marked  R  S  D  M
  118.  
  119.   The 'R' gadget is the Run gadget.  It is primarily to hold arguments to
  120.   pass to a program being run, as though they were a command line tail.
  121.   This gadget may occasionally be only part of a command line tail as will
  122.   be described below. YOU MAY CLICK-AND-ENTER IN THIS GADGET.
  123.  
  124.   The 'S' gadget is the Source gadget.  It displays the name of the currently
  125.   displayed directory or device.  If you click a device gadget, the name
  126.   will be placed here.  IF YOU CLICK-AND-ENTER into this gadget, the name
  127.   you enter will be taken as a new device or directory to access.  If access
  128.   to the entered name fails, the program will return to the last accessed
  129.   directory (or to ram: if that fails).
  130.  
  131.   The 'D' gadget is the Destination gadget.  It holds the name of the path
  132.   (or filename in some cases) to be used for certain GADGET functions such
  133.   as COPY, MOVE, RENAME, ETC.   YOU MAY CLICK-AND-ENTER IN THIS GADGET.
  134.  
  135.   The 'M' gadget is the Message gadget.  It will display messages and other
  136.   information from time to time.  IF YOU CLICK-AND-ENTER IN THIS GADGET,
  137.   I WON'T BE RESPONSIBLE.  It is supposed to be a one-way (to the user)
  138.   communication channel. (I don't think it  hurts, but it will ignore you.)
  139.  
  140. BUTTON GADGETS:  (alphabetically - almost) (room for some more - hint hint)
  141.  
  142.  ARC    This gadget requires the most complicated  selections.
  143.         When selected, the program will try to execute  'arc' with the
  144.         tail consisting of the R gadget, the D gadget and the filewindow
  145.         selected files in that order.
  146.  
  147.         i.e.  R -> a
  148.               D -> df1:Some.arc
  149.               files selected in window -> Joe.doc Bill.exe
  150.  
  151.         Result executed is ->  arc a df1:Some.arc Joe.doc
  152.                                arc a df1:Some.arc Bill.exe
  153.  
  154.         (The selections are concatenated in  R - D - files order.)
  155.         (One pass made for each file selected - sorry, no multiple tails)
  156.  
  157.         The same result can be achieved faster by this (one 'arc' load):
  158.               R -> a df1:Some.arc Joe.doc Bill.exe
  159.               D -> [empty]
  160.               files selected in window -> [none]
  161.  
  162.         To Arc v something.arc  make sure the D gadget is empty and
  163.          select the file(s) to be listed. Also works for arc t.
  164.  
  165.         If no filename is selected, it will attempt to run the
  166.         arc program with the R [and D if not empty] gadgets only.
  167.  
  168.         This gadget is versatile, and requires some experimentation on
  169.         your part to learn just how much it can (and can't) do.
  170.  
  171.  BYTES  This will total and display the number of bytes and files for
  172.         all 'selected' files in the current filewindow.
  173.  
  174.  CLEAR  This is a mass clearing of all (if any) 'selected' files.
  175.   SELECT This is the reverse. It 'selects' all files (some Du's name ALL).
  176.  
  177.  COPY   This will copy the 'selected' file(s) to the location given in the
  178.         D gadget.  THIS MUST NOT BE A FILENAME.  The path in D must be to
  179.         a valid device or directory.  Since multiple copying may be done,
  180.         copying to a specific filename is not supported.
  181.  
  182.  COPYDEL  THIS IS A PHYSICAL COPY WITH DELETE AFTER. This is identical in
  183.           operation to COPY  **EXCEPT** the original file is deleted if
  184.           the copy operation is successful.  (I got tired of reselecting
  185.           and deleting the old copies).
  186.  
  187.  DELDIR  This is the command to delete a directory (which must be 'selected'
  188.          and empty).  IF these conditions are met, the magic CONFIRM will
  189.          appear to give you one last chance to back out.  Clicking on the
  190.          DELDIR gadget again will perform the deletion. Remember that the
  191.          first click after highlighting a directory is read ONLY as the
  192.          'enter-the-directory-or-not' answer.  You will have an extra
  193.          click somewhere in this one.
  194.  
  195.  EDIT    This gadget will cause your editor to be invoked and the 'selected'
  196.          filename(s) to be used as command tail. If more than one file is
  197.          selected, they will be edited sequentially.  If no filenames are
  198.          selected, the editor will be run with no file.  The name of the
  199.          editor can be changed by patching.  Use NewZap to find the only
  200.          occurrance of 'MEmacs'.  Change it to a null terminated string
  201.          of your choice. There is space for up to an 8 character name.
  202.          This is not RUN, just EXEC'ed to prevent the program from trying
  203.          to RUN one and immediately RUN it again for the next one.
  204.  
  205.  EXEC f-R  These two will try to execute the result of sticking together
  206.   EXEC R-f the R gadget and the 'selected' filename(s)*.  The order of
  207.            placement depends on which gadget you select. If no files are
  208.            selected, EITHER  gadget will attempt to execute the R gadget
  209.            content by itself. Unlike RUN f-R etc. below, this does not
  210.            try to RUN >NIL: the program.  It uses the DOS call EXECUTE
  211.            like just typing in a command at the > prompt.
  212.  
  213.            * BE WARNED THAT THESE OPTIONS *WILL* INCLUDE ANY HIGHLIGHTED
  214.            DIRECTORY NAME IN THE ATTEMPTS TO STICK TOGETHER R+f OR f+R AND
  215.            DO IT. (So you could type 'list' in the R gadget and hit a
  216.            directory - then EXEC R+f and get a listing without entering
  217.            the directory).
  218.  
  219.            My most common use of this is for repeated copy (etc) of the same
  220.            thing.  Enter the command into R and exec it over and over.
  221.  
  222.  HPRINT   These will cause the 'selected' file(s) to be acted on.  The 'H'
  223.   HTYPE   prefixed GADGETS mean Hex output format.  If this is a multiple
  224.    PRINT  file pass, it may be aborted by clicking ANYWHERE in the window.
  225.     TYPE  The (H)PRINT commands use the PRT: device.  This may be patched
  226.           to PAR: easily since PRT: occurs only once in the program body.
  227.  
  228.  INFO     This will read the InfoBlock for the devices mentioned in S and
  229.           D (if not empty) and report free space.  Note that the ram:
  230.           device always has 0 free space. The report will always be
  231.           source first then destination.
  232.  
  233.  MAKEDIR  This will attempt to make a new directory named in the D gadget.
  234.           If no complete device:path is given, it will be relative to the
  235.           path in the current S gadget.  If it is made, then the directory
  236.           in S will be reread in case it has changed. A check is made
  237.           to insure you are not trying to create a directory with an
  238.           already existing name.
  239.  
  240.  MOVE     This is a quicker form of rename. The path (only - not name) to
  241.           move the 'selected' file(s) to should be in the D gadget. This
  242.           will attempt to rename them (between directories not devices).
  243.           Since no name change is happening, and the files can only drop
  244.           out of sight, they are eliminated from the filewindow without
  245.           re-reading the S gadget device.
  246.  
  247.  PARENT,  These two commands will attempt to 'back-up' either to the
  248.   ROOT    parent or root directory of the current device.  If they
  249.           fail (horrors) they return to the current directory.
  250.  
  251.  RELABEL  This is a teaser for my next revision.  I wanted to put it in,
  252.           but got impatient.  It will be used to relabel disks. (NOT
  253.           a paper label).
  254.  
  255.  RENAME   This attempts to rename the first 'selected' file (should be only
  256.           one for this) it finds to the name given in the D gadget. Since
  257.           it may be still in the same directory, it will re-read the
  258.           directory afterwards. Wherever feasable, MOVE is faster.
  259.  
  260.  RUN f-R  These two will try to run the result of sticking together the
  261.   RUN R-f R gadget and the 'selected' filename(s).  The order of placement
  262.           depends on which gadget you select. If no files are selected,
  263.           EITHER  gadget will attempt to RUN the R gadget content by itself,
  264.           a handy way to do small chores. This uses the DOS call to Execute
  265.           a RUN >NIL: + the selected stuff. It runs sequentially through all
  266.           'selected' files, one at a time.  BE AWARE that this can grind
  267.           your disks to dust, since as soon as RUN is done, it thinks it
  268.           is ready to RUN the next one.
  269.  
  270.  SHOW     This will attempt to EXEC any program you have named SHOW and pass
  271.           it successively the 'selected' filename(s). If no files have been
  272.           selected, nothing will happen. Show can be patched to any 8
  273.           character (maximum) filename also. It appears only once in the
  274.           program body with spaces behind it.  Change that one. The other
  275.           one is the gadget text. This is NOT RUN >NIL: for precisely the
  276.           reason mentioned in the previous description.
  277.  
  278.  ZAPFILE  This is the file delete function.  It will bring up the magic
  279.           CONFIRM message. If you click the ZAPFILE again, any and/or all
  280.           files which are currently 'selected' will be deleted.  The M
  281.           gadget will show the progress, and the deletion may be stopped
  282.           by clicking the left mouse button on any gadget (or in the
  283.           filewindow).
  284.  
  285.  D -> R   S -> D      These commands allow quick movement of R S D
  286.  D -> S   S -> R      contents.   ->  are all one-way   and  SWAP's
  287.  R -> D   SWAP S-D    are two-way.  IF THE S gadget is altered, by this,
  288.  R -> S   SWAP R-D    it will be acted on as though freshly typed in.
  289.           SWAP R-S    I got tired of so much typing.
  290.  
  291.  CONFIRM  This is not a gadget really, but a question which is to save
  292.           you from yourself.  On the destructive gadgets, you have to
  293.           click a second time to confirm what you want to do.  Even if
  294.           you click there, you can stop the activity by clicking the
  295.           left mouse button while it is going on.  The program checks
  296.           in between every deletion to see if you clicked.
  297.  
  298.  
  299.   If you have used other DirUtils, all this should be familiar.  If not,
  300.   make yourself a junk disk (one that doesn't matter what you do to it)
  301.   and try it out.  It's easy, and given time (and inclination) someone
  302.   will probably put the whole C: directory into one of these things and
  303.   still leave it in public domain.
  304.  
  305.                             COMPILATION NOTES
  306.  
  307.   When you unarc this set of files, notice that DuTypefile.def and
  308.   DuTypefile.mod are shortened to DuTypefi (etc).  Please be sure
  309.   to rename them before compiling, or it will fail.
  310.  
  311.   There are several library modules to compile first.  If you choose
  312.   to fiddle with this and re-compile it, do it in this order:
  313.  
  314.    modula DuWindow.def
  315.    modula DuWindow        (* then put in M2: *)
  316.    modula DuTypefile.def
  317.    modula DuTypefile      (*   "   *)
  318.    modula DuDir.def
  319.    modula DuDir           (*   "   *)
  320.    modula DuMisc.def
  321.    modula DuMisc          (*   "   *)
  322.    modula DuM2
  323.    link DuM2 o            (* be sure to optimize since all are $A+ *)
  324.                           (* and its too large otherwise           *)
  325.  
  326.    THEN you must newzap the load file DuM2.
  327.  
  328.    This is because I can't find a way to imbed nonprinting characters
  329.    in constants in Modula-2.  I did, but it made them spaces.  In the
  330.    DuTypefile library module is a multi-color string prompt.  To make
  331.    it work, do a newzap search for PRT: (It is only there once) and
  332.    immediately following it is the familiar <CR> next line <SPACE> next
  333.    page etc message.  Throughout that message all lower case q's must
  334.    be zapped to 1BH (esc) and the 2 lower case x's around the blanks must
  335.    be zapped to 0DH (cr).  Then the last 'end of file' message has two
  336.    lower case q's more to zap to 1BH (esc).  This is a pain, I know, but
  337.    I didn't want to waste space on a routine to do them at runtime.
  338.  
  339.    After this, you are free to name the load file any way you want.
  340.  
  341.  
  342.  
  343.  
  344.